Repository navigation
Conversation
Reduces a dep needed to be installed by users of the polyfill
Based on implementation of a similar case in D54776832.
Fixes T180509722. What happened is that the logic in LeaveSSA to find declarations within for initializers wasn't working with try/catch because the initializer block gets broken up with a maybe-throw after every instruction that can throw. These maybe-throws can then get turned into gotos by PruneMaybeThrows, so LeaveSSA has to handle both cases. The new logic scans from the start of the init block until reaching the end, and creates declarations for all StoreLocals. Note that we don't yet support maybe-throw in value blocks — that's already a todo — so the change here simply allows us to compile farther until reaching that other todo. But i've double-checked the HIR and it looks correct for this case, so it should just work once we fix that todo. I've also added a comment to help us remember (and of course, we'd have to add a snap fixture too)
Fixes T175282980. InferReactiveScopeVariables had logic to force assigning a scope to MethodCall property lookups with the idea of forcing the method call lookup to be in the same scope as the method call itself. But this doesn't work if we never assign a scope to the method call! That can happen if we're able to infer that the method call produces a primitive and doesn't need memoization. This PR changes things so that: * InferReactiveScopeVariables no longer assumes that MethodCall property values need a scope * We run a separate pass that ensures that _if_ a MethodCall has a scope, that it's property is in the scope, and that otherwise its property doesn't get a scope. This is similar to the existing passes that force a single scope for related instructions like ObjectMethod+ObjectExpression and fbt operands/calls.
Fixes T180504437. In MergeOverlappingReactiveScopes we track the active scopes and mark them as "ended" when reaching the first instruction after their mutable range. However, in cases of interleaving that will be merged, we could previously mark a scope as complete when it's original range was completed, even though the range would get extended post-merge. The fix here detects interleaving earlier, and eagerly updates the mutable ranges of the merged scopes to ensure that neither is "ended" earlier than it should. The repro here fails without this change.
Fixes T180504437. We expected `<fbt:param>` to always have no surrounding whitespace or have both leading and trailing whitespace, it can have one but not the other, though such cases are rare in practice.
This was an oversight in codegen. The entire pipeline supports multiple values in a for initializer, but codegen was dropping all but the first initializer.
I addressed some of the cases that lead to this invariant but there were still more. In this case, we have scopes like this: ``` scope @1 declarations=[t$0] { let t$0 = ArrayExpression [] if (...) { return null; } } scope @2 deps=[t$0] declarations=[t$1] { let t$1 = Jsx children=[t$0] ... } ``` Because scope 1 has an early return, PropagateEarlyReturns wraps its contents in a label and converts the returns to breaks: ``` scope @1 declarations=[t$0] earlyReturn={t$2} { let t$2 bb0: { let t$0 = ArrayExpression [] if (...) { t$2 = null; break bb0; } } } scope @2 deps=[t$0] declarations=[t$1] { let t$1 = Jsx children=[t$0] ... } ``` But then MergeReactiveScopesThatInvalidateTogether smushes them together: ``` scope @1 declarations=[t$1] earlyReturn={t$2} { let t$2 bb0: { let t$0 = ArrayExpression [] // <--- Oops! We're inside a block now if (...) { t$2 = null; break bb0; } } let t$1 = Jsx children=[t$0] ... } ``` Note that the `t$0` binding is now created inside the labeled block, so it's no longer accessible to the Jsx instruction which follows the labeled block. This isn't an issue with promoting temporaries or propagating outputs, but a simple issue of the labeled block (used for early return) introducing a new block scope. The solution here is to simply reorder the passes so that we transform for early returns after other optimizations. This means the jsx element will basically move inside the labeled block, solving the scoping issue: ``` scope @1 declarations=[t$1] earlyReturn={t$2} { let t$2 bb0: { let t$0 = ArrayExpression [] // ok, same block scope as its use if (...) { t$2 = null; break bb0; } let t$1 = Jsx children=[t$0] // note this moved inside the labeled block } } ```
"Support" in the sense of dropping these on the floor and compiling, rather than bailing out with a todo. We already don't make any guarantees about which type annotations we'll preserve through to the output, so it seems fine for now to just drop type aliases.
This was one of the last invariants firing internally, this PR adds a minimal repro and the next PR makes it a todo.
We need to revisit the conversion from value blocks into ReactiveFunction. Or just revisit ReactiveFunction altogether (see my post about what this would look like). For now, makes this case a todo.
While i'm here, we know that there are a variety of cases that are not supported yet around combining value blocks with other syntax constructs. Since we're aware of these cases and detect them, we can make this a todo instead of an invariant.
[linter] rename ReactForgetDiagnostics to ReactCompilerRule
I addressed some of the cases that lead to this invariant but there were still more. In this case, we have scopes like this: ``` scope @1 declarations=[t$0] { let t$0 = ArrayExpression [] if (...) { return null; } } scope @2 deps=[t$0] declarations=[t$1] { let t$1 = Jsx children=[t$0] ... } ``` Because scope 1 has an early return, PropagateEarlyReturns wraps its contents in a label and converts the returns to breaks: ``` scope @1 declarations=[t$0] earlyReturn={t$2} { let t$2 bb0: { let t$0 = ArrayExpression [] if (...) { t$2 = null; break bb0; } } } scope @2 deps=[t$0] declarations=[t$1] { let t$1 = Jsx children=[t$0] ... } ``` But then MergeReactiveScopesThatInvalidateTogether smushes them together: ``` scope @1 declarations=[t$1] earlyReturn={t$2} { let t$2 bb0: { let t$0 = ArrayExpression [] // <--- Oops! We're inside a block now if (...) { t$2 = null; break bb0; } } let t$1 = Jsx children=[t$0] ... } ``` Note that the `t$0` binding is now created inside the labeled block, so it's no longer accessible to the Jsx instruction which follows the labeled block. This isn't an issue with promoting temporaries or propagating outputs, but a simple issue of the labeled block (used for early return) introducing a new block scope. The solution (in the next PR) is to simply reorder the passes so that we transform for early returns after other optimizations. This means the jsx element will basically move inside the labeled block, solving the scoping issue: ``` scope @1 declarations=[t$1] earlyReturn={t$2} { let t$2 bb0: { let t$0 = ArrayExpression [] // ok, same block scope as its use if (...) { t$2 = null; break bb0; } let t$1 = Jsx children=[t$0] // note this moved inside the labeled block } } ```
Repro from T180504728 which reproduced internally and on playground, neither of which have react#2687 yet. That PR (earlier in this stack) already fixes the issue, so i'm just adding the repro to help prevent regressions.
---
Previously, we always emitted `Memoize dep` instructions after the function
expression literal and depslist instructions
```js
// source
useManualMemo(() => {...}, [arg])
// lowered
$0 = FunctionExpression(...)
$1 = LoadLocal (arg)
$2 = ArrayExpression [$1]
$3 = Memoize (arg)
$4 = Call / LoadLocal
$5 = Memoize $4
```
Now, we insert `Memoize dep` before the corresponding function expression
literal:
```js
// lowered
$0 = StartMemoize (arg) <---- this moved up!
$1 = FunctionExpression(...)
$2 = LoadLocal (arg)
$3 = ArrayExpression [$2]
$4 = Call / LoadLocal
$5 = FinishMemoize $4
```
Design considerations:
- react#2663 needs to understand which lowered instructions belong to a manual
memoization block, so we need to emit `StartMemoize` instructions before the
`useMemo/useCallback` function argument, which contains relevant memoized
instructions
- we choose to insert StartMemoize instructions to (1) avoid unsafe instruction
reordering of source and (2) to ensure that Forget output does not change when
enabling validation
This PR only renames `Memoize` -> `Start/FinishMemoize` and hoists
`StartMemoize` as described. The latter may help with stricter validation for
`useCallback`s, although testing is left to the next PR.
react#2663 contains all validation changes
…ves subset
of dependencies from source
---
`validatePreserveExistingMemoizationGuarantees` previously checked
- manual memoization dependencies and declarations (the returned value) do not
"lose" memoization due to inferred mutations
```
function useFoo() {
const y = {};
// bail out because we infer that y cannot be a dependency of x as its
mutableRange
// extends beyond
const x = useMemo(() => maybeMutate(y), [y]);
// similarly, bail out if we find that x or y are mutated here
return x;
}
```
- manual memoization deps and decls do not get deopted due to hook calls
```
function useBar() {
const x = getArray();
useHook();
mutate(x);
return useCallback(() => [x], [x]);
}
```
This PR updates `validatePreserveExistingMemoizationGuarantees` with the
following correctness conditions:
*major change* All inferred dependencies of reactive scopes between
`StartMemoize` and `StopMemoize` instructions (e.g. scopes containing manual
memoization code) must either:
1. be produced from earlier within the same manual memoization block
2. exactly match an element of depslist from source
This assumes that the source codebase mostly follows the `exhaustive-deps` lint
rule, which ensures that deps lists are (1) simple expressions composing of
reads from named identifiers + property loads and (2) exactly match deps usages
in the useMemo/useCallback itself.
---
Validated that this does not change source by running internally on ~50k files
(no validation on `main`, no validation on this PR, and validation on this PR).
Remove private header from playground Before we miss removing this from the public release, I think we can remove this header now already. We're still behind a secret URL + password.
--- Many compiler errors have neither descriptions nor suggestions (e.g. most `todo` or `invariant` errors), so let's make those optional
This case is specific to early return inside an inlined IIFE (which can often occur as a result of dropping manual memoization). When we inline IIFEs, as a reminder we wrap the body in a labeled block and convert returns to assignment of a temporary + break out of the label. Those reassignments themselves are getting a reactive scope assigned since the reassigned value has a mutable range. They don't really need a mutable range or scope, though. And then the presence of the `break` statements means that we can sometimes exit out of the scope before reaching the end - leading to unreachable code. This can only occur though where _all the values are already memoized_. So the code works just fine and even memoizes just fine - it's just that we have some extraneous scopes and there is technically unreachable code. I'll fix in a follow-up, adding a repro here.
Extracts a helper from the repro earlier in the stack into a helper in shared-runtime. This makes it easy to verify that memoization is actually working.
The example earlier in the stack had unreachable code in the output because there was an unnecessary memoization block around an assignment. This was a holdover from before we moved the logic to expand mutable ranges for phis from LeaveSSA to InferMutableRanges. We were conservatively assigning a mutable range to all variables with a phi, even those that didn't strictly need one. Removing the range extension logic in LeaveSSA fixed the issue, but uncovered the fact that AlignReactiveScopesToBlockScopes was missing a case to handle optionals. ## Test Plan Synced internally and ran a snapshot/comparison of compilation before/after (P1197734337 for those curious). The majority of components get fewer memo slots thanks to not needing to memoize non-allocating value block expressions like ternaries/optionals. In a few cases, the fact that we're no longer assigning a mutable range for value blocks (unless there is actually a mutation!) means we get more fine-grained memoization and increase the number of memoization blocks. So overall this appears to be correct, improve memoization, and reduce code size.
Fbt violates the JSX spec by using a lowercase function as a tagname, even though lowercase names are reserved for builtins. Here we detect cases where there is an `<fbt>` tag where `fbt` is a local identifier and throw a todo.
Fbt enums appear to rely on source locations and something that we're doing (maybe destructuring?) isn't preserving locations such that the fbt plugin breaks.
<img width="553" alt="Screenshot 2024-03-19 at 4 41 15 PM" src="https://github.com/facebook/react-forget/assets/6425824/e87ee704-6c67-4e10-824b-71e97e7e19f5"> Slightly improves source locations for JSX elements so that the opening and closing tag have distinct locations that match up with source. The identifier itself within the closing tag still has the wrong location, but at least this is an improvement. Doesn't fix the fbt thing but it was worth a try.
I need to do more debugging to figure out exactly why the example earlier fails — but whatever it is, it's clearly a matter of the fbt plugin relying on some specifics of source locations. Here we just detect multiple instances of `<fbt:enum>` within a given `<fbt>` tag and throw a todo.
ghstack-source-id: cd40da2 Pull Request resolved: https://github.com/facebook/react-forget/pull/2954
runReactBabelPluginReactCompiler brings in fbt which is unnecessary for OSS so I removed it. Also makes it so healthckeck is installed as an executable ghstack-source-id: ec6c76f Pull Request resolved: https://github.com/facebook/react-forget/pull/2955
Don't really have time to implement the react-compiler/healthcheck version of this script, so for now i propose we just publish this as react-compiler-healthcheck the command for running this would be ``` $ npx react-compiler-healthcheck --src 'whatever/**/*.*' ``` ghstack-source-id: e2c443a Pull Request resolved: https://github.com/facebook/react-forget/pull/2956
ghstack-source-id: b8db172 Pull Request resolved: https://github.com/facebook/react-forget/pull/2957
ghstack-source-id: c06d449 Pull Request resolved: https://github.com/facebook/react-forget/pull/2958
ghstack-source-id: 087985c Pull Request resolved: https://github.com/facebook/react-forget/pull/2959
ghstack-source-id: 6f9e7f9 Pull Request resolved: https://github.com/facebook/react-forget/pull/2960
ghstack-source-id: 93055b9 Pull Request resolved: https://github.com/facebook/react-forget/pull/2961
`forget_napi` doesn't exist and given we're not currently working on the Rust compiler, I'm not sure we need to keep this around until we know that we do want to invest into this area again.
ghstack-source-id: b6d58988eeb86e657a6db2a481b6c2fe2fba0344 Pull Request resolved: https://github.com/facebook/react-forget/pull/2962
ghstack-source-id: e2507b7285bb52ee02d2cece35aa16eb0bc0baa5 Pull Request resolved: https://github.com/facebook/react-forget/pull/2963
ghstack-source-id: 28045c6edb342dea125ea8fcea564ce90626f21d Pull Request resolved: https://github.com/facebook/react-forget/pull/2964
The [`files` field](https://docs.npmjs.com/cli/v10/commands/npm-publish#files-included-in-package) controls what files get included in the published package. This PR specifies the `files` field on our publishable packages to only include the `dist` directory, since we don't need to ship any types or sourcemaps with 3 of them. react-compiler-runtime is a runtime package which has sourcemaps, so we also include the `src` directory in the published package. Also fixes an invalid version range for the react peer dependency in react-compiler-runtime, tested that it works via https://semver.npmjs.com/ ghstack-source-id: 12b36c203fc9fd8d72a1995fb3fba2312de4aa51 Pull Request resolved: https://github.com/facebook/react-forget/pull/2965
Adds a script to publish babel-plugin-react-compiler,
eslint-plugin-react-compiler, and react-compiler-healthcheck to npm.
Instructions are in a comment in scripts/publish.js, please read
carefully before using this script!
Test plan:
```
$ yarn npm:publish
yarn run v1.22.10
$ node scripts/publish
ℹ Preparing to publish (dry run) [debug=false]
ℹ Building packages
✔ Successfully built babel-plugin-react-compiler
✔ Successfully built eslint-plugin-react-compiler
✔ Successfully built react-compiler-healthcheck
ℹ Dry run: Report tarball contents
========== babel-plugin-react-compiler ==========
⠴ Running npm pack --dry-run
npm WARN config init.author.name Use `--init-author-name` instead.
npm WARN config init.author.email Use `--init-author-email` instead.
⠦ Running npm pack --dry-run
npm notice
npm notice 📦 babel-plugin-react-compiler@0.0.1
npm notice === Tarball Contents ===
npm notice 11B dist/__tests__/DisjointSet-test.d.ts
npm notice 11B dist/__tests__/envConfig-test.d.ts
npm notice 11B dist/__tests__/Logger-test.d.ts
npm notice 11B dist/__tests__/parseConfigPragma-test.d.ts
npm notice 11B dist/__tests__/Result-test.d.ts
npm notice 145B dist/__tests__/test-utils/validateNoUseBeforeDefine.d.ts
npm notice 144B dist/Babel/BabelPlugin.d.ts
npm notice 350B dist/Babel/RunReactCompilerBabelPlugin.d.ts
npm notice 2.4kB dist/CompilerError.d.ts
npm notice 455B dist/Entrypoint/Gating.d.ts
npm notice 376B dist/Entrypoint/Imports.d.ts
npm notice 166B dist/Entrypoint/index.d.ts
npm notice 1.8kB dist/Entrypoint/Options.d.ts
npm notice 1.3kB dist/Entrypoint/Pipeline.d.ts
npm notice 819B dist/Entrypoint/Program.d.ts
npm notice 295B dist/Entrypoint/Reanimated.d.ts
npm notice 753B dist/Entrypoint/Suppression.d.ts
npm notice 113B dist/HIR/AssertConsistentIdentifiers.d.ts
npm notice 115B dist/HIR/AssertTerminalSuccessorsExist.d.ts
npm notice 529B dist/HIR/AssertValidBlockNesting.d.ts
npm notice 110B dist/HIR/AssertValidMutableRanges.d.ts
npm notice 585B dist/HIR/BuildHIR.d.ts
npm notice 116B dist/HIR/BuildReactiveScopeTerminalsHIR.d.ts
npm notice 125B dist/HIR/ComputeUnconditionalBlocks.d.ts
npm notice 602B dist/HIR/Dominator.d.ts
npm notice 12.7kB dist/HIR/Environment.d.ts
npm notice 184B dist/HIR/FindContextIdentifiers.d.ts
npm notice 401B dist/HIR/Globals.d.ts
npm notice 22.2kB dist/HIR/HIR.d.ts
npm notice 2.8kB dist/HIR/HIRBuilder.d.ts
npm notice 1.1kB dist/HIR/index.d.ts
npm notice 108B dist/HIR/MergeConsecutiveBlocks.d.ts
npm notice 115B dist/HIR/MergeOverlappingReactiveScopesHIR.d.ts
npm notice 2.2kB dist/HIR/ObjectShape.d.ts
npm notice 1.4kB dist/HIR/PrintHIR.d.ts
npm notice 106B dist/HIR/PruneUnusedLabelsHIR.d.ts
npm notice 1.1kB dist/HIR/Types.d.ts
npm notice 1.9kB dist/HIR/visitors.d.ts
npm notice 776B dist/index.d.ts
npm notice 5.4MB dist/index.js
npm notice 429B dist/Inference/AnalyseFunctions.d.ts
npm notice 324B dist/Inference/DropManualMemoization.d.ts
npm notice 436B dist/Inference/index.d.ts
npm notice 224B dist/Inference/InferAlias.d.ts
npm notice 204B dist/Inference/InferAliasForPhis.d.ts
npm notice 206B dist/Inference/InferAliasForStores.d.ts
npm notice 115B dist/Inference/InferMutableContextVariables.d.ts
npm notice 151B dist/Inference/InferMutableLifetimes.d.ts
npm notice 109B dist/Inference/InferMutableRanges.d.ts
npm notice 212B dist/Inference/InferMutableRangesForAlias.d.ts
npm notice 106B dist/Inference/InferReactivePlaces.d.ts
npm notice 368B dist/Inference/InferReferenceEffects.d.ts
npm notice 201B dist/Inference/InferTryCatchAliases.d.ts
npm notice 130B dist/Inference/InlineImmediatelyInvokedFunctionExpressions.d.ts
npm notice 106B dist/Optimization/ConstantPropagation.d.ts
npm notice 258B dist/Optimization/DeadCodeElimination.d.ts
npm notice 177B dist/Optimization/index.d.ts
npm notice 103B dist/Optimization/PruneMaybeThrows.d.ts
npm notice 108B dist/ReactiveScopes/AlignMethodCallScopes.d.ts
npm notice 110B dist/ReactiveScopes/AlignObjectMethodScopes.d.ts
npm notice 133B dist/ReactiveScopes/AlignReactiveScopesToBlockScopes.d.ts
npm notice 126B dist/ReactiveScopes/AlignReactiveScopesToBlockScopesHIR.d.ts
npm notice 132B dist/ReactiveScopes/AssertScopeInstructionsWithinScope.d.ts
npm notice 125B dist/ReactiveScopes/AssertWellFormedBreakTargets.d.ts
npm notice 363B dist/ReactiveScopes/BuildReactiveBlocks.d.ts
npm notice 142B dist/ReactiveScopes/BuildReactiveFunction.d.ts
npm notice 759B dist/ReactiveScopes/CodegenReactiveFunction.d.ts
npm notice 154B dist/ReactiveScopes/CollectReactiveIdentifiers.d.ts
npm notice 128B dist/ReactiveScopes/CollectReferencedGlobals.d.ts
npm notice 698B dist/ReactiveScopes/DeriveMinimalDependencies.d.ts
npm notice 138B dist/ReactiveScopes/ExtractScopeDeclarationsFromDestructuring.d.ts
npm notice 121B dist/ReactiveScopes/FlattenReactiveLoops.d.ts
npm notice 124B dist/ReactiveScopes/FlattenScopesWithHooksOrUse.d.ts
npm notice 2.1kB dist/ReactiveScopes/index.d.ts
npm notice 370B dist/ReactiveScopes/InferReactiveScopeVariables.d.ts
npm notice 217B dist/ReactiveScopes/MemoizeFbtOperandsInSameScope.d.ts
npm notice 127B dist/ReactiveScopes/MergeOverlappingReactiveScopes.d.ts
npm notice 138B dist/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.d.ts
npm notice 1.0kB dist/ReactiveScopes/PrintReactiveFunction.d.ts
npm notice 123B dist/ReactiveScopes/PromoteUsedTemporaries.d.ts
npm notice 118B dist/ReactiveScopes/PropagateEarlyReturns.d.ts
npm notice 127B dist/ReactiveScopes/PropagateScopeDependencies.d.ts
npm notice 123B dist/ReactiveScopes/PruneAllReactiveScopes.d.ts
npm notice 126B dist/ReactiveScopes/PruneAlwaysInvalidatingScopes.d.ts
npm notice 117B dist/ReactiveScopes/PruneHoistedContexts.d.ts
npm notice 227B dist/ReactiveScopes/PruneNonEscapingScopes.d.ts
npm notice 125B dist/ReactiveScopes/PruneNonReactiveDependencies.d.ts
npm notice 122B dist/ReactiveScopes/PruneTemporaryLValues.d.ts
npm notice 118B dist/ReactiveScopes/PruneUnusedLabels.d.ts
npm notice 118B dist/ReactiveScopes/PruneUnusedScopes.d.ts
npm notice 123B dist/ReactiveScopes/RenameVariables.d.ts
npm notice 114B dist/ReactiveScopes/StabilizeBlockIds.d.ts
npm notice 3.1kB dist/ReactiveScopes/visitors.d.ts
npm notice 170B dist/SSA/EliminateRedundantPhi.d.ts
npm notice 101B dist/SSA/EnterSSA.d.ts
npm notice 154B dist/SSA/index.d.ts
npm notice 99B dist/SSA/LeaveSSA.d.ts
npm notice 63.5kB dist/tsconfig.tsbuildinfo
npm notice 43B dist/TypeInference/index.d.ts
npm notice 103B dist/TypeInference/InferTypes.d.ts
npm notice 352B dist/Utils/ComponentDeclaration.d.ts
npm notice 256B dist/Utils/DisjointSet.d.ts
npm notice 322B dist/Utils/HookDeclaration.d.ts
npm notice 613B dist/Utils/logger.d.ts
npm notice 2.3kB dist/Utils/Result.d.ts
npm notice 119B dist/Utils/RuntimeDiagnosticConstants.d.ts
npm notice 1.1kB dist/Utils/Stack.d.ts
npm notice 149B dist/Utils/todo.d.ts
npm notice 782B dist/Utils/utils.d.ts
npm notice 603B dist/Validation/index.d.ts
npm notice 117B dist/Validation/ValidateContextVariableLValues.d.ts
npm notice 109B dist/Validation/ValidateHooksUsage.d.ts
npm notice 214B dist/Validation/ValidateMemoizedEffectDependencies.d.ts
npm notice 113B dist/Validation/ValidateNoCapitalizedCalls.d.ts
npm notice 114B dist/Validation/ValidateNoRefAccesInRender.d.ts
npm notice 113B dist/Validation/ValidateNoSetStateInRender.d.ts
npm notice 131B dist/Validation/ValidatePreservedManualMemoization.d.ts
npm notice 102B dist/Validation/ValidateUseMemo.d.ts
npm notice 2.3kB package.json
npm notice === Tarball Details ===
npm notice name: babel-plugin-react-compiler
npm notice version: 0.0.1
npm notice filename: babel-plugin-react-compiler-0.0.1.tgz
npm notice package size: 1.1 MB
npm notice unpacked size: 5.5 MB
npm notice shasum: 9a0fb71bdc904d6ab92432a506b0e037f10dd7ce
npm notice integrity: sha512-hXtObyIEP4MbO[...]jstRbpztyLf4g==
npm notice total files: 119
npm notice
========== eslint-plugin-react-compiler ==========
⠴ Running npm pack --dry-run
npm WARN config init.author.name Use `--init-author-name` instead.
npm WARN config init.author.email Use `--init-author-email` instead.
⠋ Running npm pack --dry-run
npm notice
npm notice 📦 eslint-plugin-react-compiler@0.0.0
npm notice === Tarball Contents ===
npm notice 827B README.md
npm notice 2.1MB dist/index.js
npm notice 968B package.json
npm notice === Tarball Details ===
npm notice name: eslint-plugin-react-compiler
npm notice version: 0.0.0
npm notice filename: eslint-plugin-react-compiler-0.0.0.tgz
npm notice package size: 300.5 kB
npm notice unpacked size: 2.1 MB
npm notice shasum: f24dab544b03d36d9bb676a16256f114bd5e0ed6
npm notice integrity: sha512-8PcKZXZ+RVBDP[...]D7jFmkvHJoBeA==
npm notice total files: 3
npm notice
========== react-compiler-healthcheck ==========
⠼ Running npm pack --dry-run
npm WARN config init.author.name Use `--init-author-name` instead.
npm WARN config init.author.email Use `--init-author-email` instead.
⠏ Running npm pack --dry-run
npm notice
npm notice 📦 react-compiler-healthcheck@0.0.0
npm notice === Tarball Contents ===
npm notice 2.1MB dist/index.js
npm notice 677B package.json
npm notice 1.8kB rollup.config.js
npm notice 1.1kB src/checks/libraryCompat.ts
npm notice 3.2kB src/checks/reactCompiler.ts
npm notice 759B src/checks/strictMode.ts
npm notice 67B src/config.ts
npm notice 1.5kB src/index.ts
npm notice 602B tsconfig.json
npm notice === Tarball Details ===
npm notice name: react-compiler-healthcheck
npm notice version: 0.0.0
npm notice filename: react-compiler-healthcheck-0.0.0.tgz
npm notice package size: 290.4 kB
npm notice unpacked size: 2.1 MB
npm notice shasum: 55c0eb57aebc7305270a29e78ebf6c056044bae0
npm notice integrity: sha512-nPVhGyh8i9PoO[...]v52c3U0tKGpzA==
npm notice total files: 9
npm notice
✔ Please confirm contents of packages before publishing. You can run this command again with --for-real to publish to npm
✨ Done in 61.19s.
```
```
$ yarn npm:publish --debug --for-real
yarn run v1.22.10
$ node scripts/publish --debug --for-real
ℹ Preparing to publish (for real) [debug=true]
ℹ Building packages
✔ Successfully built babel-plugin-react-compiler
✔ Successfully built eslint-plugin-react-compiler
✔ Successfully built react-compiler-healthcheck
✔ Bumped babel-plugin-react-compiler to 0.0.0-experimental-2769f7a-20240513
✔ Bumped eslint-plugin-react-compiler to 0.0.0-experimental-e04a001-20240513
✔ Bumped react-compiler-healthcheck to 0.0.0-experimental-410375f-20240513
========== babel-plugin-react-compiler ==========
⠋ Publishing babel-plugin-react-compiler to npm
Command that would have run: npm publish --dry-run
/Users/lauren/code/react-forget/compiler/scripts/publish.js:188
throw new Error(
^
Error: This error is intentional, please double check scripts/publish.js and remove this error prior to publishing
at main (/Users/lauren/code/react-forget/compiler/scripts/publish.js:188:13)
Node.js v20.11.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```
On the day of launch, remove the hardcoded error, then run `yarn
npm:publish --debug --for-real` first as a sanity check. Confirm the
contents are correct.
Then when you are certain, run `yarn npm:publish --for-real`, and push
the commited version bumps to GitHub so the hashes that the packages
originate from are public.
ghstack-source-id: 403bc22d4b340056fd112fcfc38580f28ed6c986
Pull Request resolved: https://github.com/facebook/react-forget/pull/2966
ghstack-source-id: a1776f97d5f7d4d8e02886906eb001e358628fc8 Pull Request resolved: https://github.com/facebook/react-forget/pull/2967
ghstack-source-id: 43bb0c8c957fc550203445868c90fa706e3a8d11 Pull Request resolved: https://github.com/facebook/react-forget/pull/2968
Code Unpacked · walkthroughA source-backed review of the complete compiler import, with 12 deep-dive chapters and explicit boundaries for tests, runtime compatibility, playground and Rust WIP. Source revision: 13 chapters and 37 source-linked steps. Open the HTML locally to navigate the overview and deep dives, or play the walkthrough. Source coverage limitations
Download and openDownload the complete walkthrough viewer (ZIP). Extract it and open Browse the committed artifact index. Delivery uses committed files in this fork; these links are not browser-uploaded attachments. |
Code Unpacked · reverse-designReact Compiler — reconstructed architecture and review contracts Source revision: The full inline explanation exceeds the comment budget. Complete documents, diagrams, and source coverage are preserved in the HTML attachment (extract the ZIP first when supplied). Source coverage limitations
22 of 22 source limitations shown. The complete list is retained in the artifact manifest and HTML. Download and openDownload the complete reverse-design viewer (ZIP). Extract it and open Browse the committed artifact index. Delivery uses committed files in this fork; these links are not browser-uploaded attachments. |
Code Unpacked · code-mapStart with topic/flow filters for compiler boundaries; search the complete file inventory for supporting fixtures, snapshots, Rust WIP, playground and packaging. Unchanged React runtime neighbors are contextual files. Dynamic calls and unsupported parsing remain explicit gaps. Manually reviewed direct-call edges supplement extractor gaps and retain separate provenance. Source revision: 3673 file cards · 3275 symbols · 2032 source-backed relationships. Includes file/function exploration, callers and callees, topic/flow filters, syntax highlighting, and source gaps. The complete large HTML is packaged in the lossless ZIP linked below. Source coverage limitations
Download and openDownload the complete code-map viewer (ZIP). Extract it and open Browse the committed artifact index. Delivery uses committed files in this fork; these links are not browser-uploaded attachments. |
Code Unpacked · review-quiz16 questions about React Compiler review readiness — 16 source-backed checks, with deterministic scoring and source-linked recommendations. Source revision: Download and open Source coverage limitations
Download and openDownload the complete review-quiz viewer (ZIP). Extract it and open Browse the committed artifact index. Delivery uses committed files in this fork; these links are not browser-uploaded attachments. |
Code Unpacked · xkcdReact Compiler: three review traps: Original black-and-white stick-figure comics about three distinct compiler invariants, with complete in-image dialogue and captions. Source revision: The flag moved the floor — Metaphor for named-declaration gating. Default exports and function expressions have different replacement forms; this is not a complete treatment of JavaScript hoisting. The cache cannot skip roll call — Hook/use scope flattening is output safety, not exhaustive input validation or a promise that every value is memoized. Do not wake the property — A broader dependency can cause extra recomputation. Safety relies on the compiler immutability assumptions and does not promise minimal invalidation. The generated images include the full explanation. Source-backed accessible transcripts are available in the HTML and transcript.md. Source coverage limitations
Download and openDownload the complete xkcd viewer (ZIP). Extract it and open Browse the committed artifact index. Delivery uses committed files in this fork; these links are not browser-uploaded attachments. |



Recreates React Compiler's original upstream PR in this fork for a Code Unpacked showcase. The captured source difference contains 3,669 changed files (+358,424 / -0); this fork additionally commits the generated review assets.
Download the complete offline bundle, or choose a format below. Extract a viewer ZIP and open its
index.htmllocally. The comics also appear inline in their comment.The complete bundle includes all five canonical outputs, shared source context and analysis, authored documents and diagrams, comics and transcripts, manifests, delivery receipts, and validation/provenance records. Each changed-file inventory entry is retained; the authored explanations focus on selected compiler/runtime topics and disclose source omissions and parser limitations.
Source pins: base
915b914b3a05b60590c75851464e1ca75249976d, analyzed head575477a2e8f9db57ef4a1bf0d3b449e4f8244af8. The later artifact commits retain that analyzed source as an ancestor. Format comments pin their downloads to an artifact commit; the full bundle above is pinned to57015722bb9cf2fbb2b2be9409c57bb79a7e85b9.Generated with Code Unpacked 0.3.0 at
ed416d3f18ace6531ebd4601ad6a6769e8ead971, then refreshed with the fixes in agentic-code-unpacked#6. The report there documents capture, TypeScript extraction, ZIP/comment delivery, map fitting, and mobile layout defects found during these runs.The five viewers passed offline browser checks; hashes and public viewer/image downloads were verified. Native browser attachment controls were unavailable, so delivery uses explicitly labeled committed files. These artifacts explain captured code; upstream compiler/application suites were not run, and the upstream discussion is not treated as proof of correctness.